﻿using ASmile.Com;
using ASmile.Com.Da;
using ASmile.DBModel;
using Microsoft.AspNetCore.Mvc;

namespace ASmile.Web.ApiControllers.SysManage
{
    /// <summary>
    /// GridCombox 配置
    /// </summary>
    [Route("api/SysManage/[controller]/[action]")]
    [ApiExplorerSettings(GroupName = "SysManage")]
    public class GridComboxController : BaseApiController<GridComboxBLL>
    {
        /// <summary>
        /// 获取配置
        /// </summary>
        [HttpPost]
        [UserAuthorize(true,false)]
        public ApiResult<GridComboxRet> GetConfig(ArgId arg)
        {
            return BLLObj.GetConfig(arg.Id);
        }
        /// <summary>
        /// 获取住记录
        /// </summary>
        [HttpPost]
        public ApiResultList<Sys_GridCombox> GetMainData(GridComboxArg arg)
        {
            return BLLObj.GetMainData(arg);
        }
        /// <summary>
        /// 增加表格配置
        /// </summary>
        [HttpPost]
        public ApiResult<string> AddMain(Sys_GridCombox model)
        {
            return BLLObj.AddMain(model);
        }
        /// <summary>
        /// 编辑配置记录
        /// </summary>
        [HttpPost]
        public ApiResult<string> EditMain(Sys_GridCombox model)
        {
            return BLLObj.EditMain(model);
        }
        /// <summary>
        /// 移除主记录及主记录的列信息
        /// </summary>
        [HttpPost]
        public ApiResult DelMain(Sys_GridCombox model)
        {
            return BLLObj.DelMain(model);
        }
        /// <summary>
        /// 获取指定列信息 {"MainId":"主记录Id"}
        /// </summary>
        [HttpPost]
        public ApiResultList<Sys_GridCombox_Column> GetColumnData(ArgId arg)
        {
            var rList = BLLObj.GetColumnData(arg.Id);
            return this.RetOK(rList, 0, "OK");
        }
        /// <summary>
        /// 增加列
        /// </summary>
        [HttpPost]
        public ApiResult<string> AddColumn(Sys_GridCombox_Column model)
        {
            return BLLObj.AddColumn(model);
        }
        /// <summary>
        /// 编辑列
        /// </summary>
        [HttpPost]
        public ApiResult<string> EditColumn(Sys_GridCombox_Column model)
        {
            return BLLObj.EditColumn(model);
        }
        /// <summary>
        /// 删除指定列
        /// </summary>
        [HttpPost]
        public ApiResult DelColumn(Sys_GridCombox_Column model)
        {
            return BLLObj.DelColumn(model);
        }
        /// <summary>
        /// 交换排序
        /// </summary>
        [HttpPost]
        public ApiResult SwapOrderNo(ArgSwapOrderNo arg)
        {
            return BLLObj.SwapOrderNo(arg);
        }
    }
}